extends Button

var item = null

func set_item(item_arg):
	item = item_arg
	
func _ready():
	if not item: 
		$hbox/name.text = "Nothing"
		$hbox/amount.text = ""
		$hbox/amount.visible = false
		$hbox/icon.texture = null
		return
	$hbox/name.text = item.definition.full_name()
	if item.amount > 1:
		$hbox/amount.text = str(item.amount) + "x"
	else:
		$hbox/amount.visible = false
	$hbox/icon.texture = item.definition.icon()

func _process(delta):
	pass

